import {MenuType} from '@/types/menu'
import getViews from './getViews'
import router from '@/router'
const dynicRoute=(ary:Array<MenuType>)=>{
   ary.forEach(item=>{
      if(item.childList&&item.childList.length>0){
         dynicRoute(item.childList)
      }else{
        console.log('item',getViews(`../views${item.component}.vue`));
        //动态添加路由配置
        router.addRoute('home',{
            path:item.component,
            component:getViews(`../views${item.component}.vue`)
        })
        
      }
   })
}
export default dynicRoute